<template>
    <s-layout title="详情">
      <view>
		<view class="form-item">
            <uni-section title="用户上传信息" type="line">
                <view class="area-boxs">
                    <view class="title ss-m-b-30"> 信息 </view>
                    <uni-easyinput
                    type="textarea"
                    maxlength="120"
                    autoHeight
                    disabled
                    placeholder=""
                    v-model="state.listinfo.record_list_content"></uni-easyinput>
                </view>
                <view class=" area-boxs img-box">
                    <view class="title ss-m-b-30">图片</view>
                    <view class="" style="display: flex;">
                        <image  v-for="(item,index) in state.listimage"  style="width:168rpx;height:168rpx;margin-left:20rpx;" :src="item.image" mode=""></image>
                    </view>
                </view>
            </uni-section>
			<!-- <view class="area-boxs">
				<view class="title ss-m-b-30">审核人</view>
				<view class="">
					<text>{{ state.listinfo.record_sid }}</text>
				</view>
			</view>
			 -->
			<!-- <view class="area-boxs">
				<view class="title ss-m-b-30">状态</view>
				<view class="">
					<text v-if="state.listinfo.record_list_status == 0">待审核</text>
					<text v-if="state.listinfo.record_list_status == 1">已完成</text>
					<text v-if="state.listinfo.record_list_status == 2">已拒绝</text>
				</view>
			</view> -->
            <uni-section title="审核用户上传信息" type="line">
                <uni-forms ref="auditionRef" :rules="auditionRules" :modelValue="state.model">

                    <view class="example">
                        <view class="area-boxs">
                            <view class="title ss-m-b-30">审核人</view>
                            <text>{{ state.listinfo.record_sid_name }}</text>
                        </view>
                    </view>
                    <view class="example">
                        <view class="area-boxs">
                            <view class="title ss-m-b-30">审核状态</view>
                            <tag v-if="state.listinfo.record_list_status == 0">待审核</tag>
					        <tag v-if="state.listinfo.record_list_status == 1" type="success" >已完成</tag>
					        <tag v-if="state.listinfo.record_list_status == 2"  type="error">已拒绝</tag>
                            <!-- <uni-data-checkbox v-model="state.model.record_list_status" :localdata="sexs" /> -->
                        </view>
                    </view>


                    <view class="example">
                        <view class="area-boxs">
                            <view class="title ss-m-b-30">审核反馈</view>
                            <uni-easyinput
                            type="textarea"
                            maxlength="120"
                            autoHeight
                            placeholder=""
                            disabled
                            v-model="state.listinfo.record_list_feedback"></uni-easyinput>
                        </view>
                    </view>
                    <view class="example">
                        <view class="area-boxs">
                            <view class="title ss-m-b-30">用户上传时间</view>
                            <text>{{ state.listinfo.record_list_createtime }}</text>
                        </view>
                    </view>


                    <view class="example">
                        <view class="area-boxs">
                            <view class="title ss-m-b-30">审核时间</view>
                            <text>{{ state.listinfo.record_list_endtime }}</text>
                        </view>
                    </view>


                </uni-forms>
            </uni-section>
		</view>
    </view>

    </s-layout>
  </template>
  
  <script setup>
    import { ref } from 'vue'
    import sheep from '@/sheep';
    import { onLoad } from '@dcloudio/uni-app';
    import { computed, reactive } from 'vue';
  


    const sexs = reactive([
        {
            text: '通过',
            value: 1
        }, 
        {
            text: '不通过',
            value: 2
        }
    ])

    const goId = ref(0);

    const state = reactive({
        model:{
            record_list_status:1
        },
        listinfo:{},
        listimage:{}
    });
  
    const apiUrl = ref(import.meta.env.SHOPRO_BASE_URL)

  
    onLoad(async (options) => {
      console.log(options)
      let id = '';
      if (options.id) {
        id = options.id
        state.model.id = options.id
      }

      if(options.goId){
        goId.value =  options.goId
      }
      
      const res = await sheep.$api.audition.getUserOrderListDetail({id})
	     console.log(res)
        if(res.code == 1){
            state.listinfo = res.data.listinfo
            res.data.listimage.forEach((item,index) => {
                item.image = apiUrl.value +  item.images
				console.log(item.images)
                
            })

            state.listimage = res.data.listimage
            console.log(state.listimage)
        }    


    });


    async function submit()
    {
        console.log(state.model)
        console.log(goId.value)
        const res = await sheep.$api.audition.updateAudition(state.model)
        console.log(res)
        if(res.code == 1){
            sheep.$helper.toast('更新成功');
            sheep.$router.go('/pages/task/audition/orderlist', {
                id:goId.value
            });
        }
    }
  </script>
  
  <style lang="scss" scoped>
    // 评价商品
    .goods-card {
      margin: 10rpx 0;
      padding: 20rpx;
      background: #fff;
    }
  
    // 评论，选择图片
    .form-item {
      background: #fff;
      .star-box {
        height: 100rpx;
        padding: 0 25rpx;
      }
      .star-title {
        font-weight: 600;
      }
    }
	.area-box {
	  width: 690rpx;
	  min-height: 306rpx;
	  background: rgba(249, 250, 251, 1);
	  border-radius: 20rpx;
	  padding: 28rpx;
	  margin: auto;
	  
	  .img-box {
	    margin-top: 20rpx;
	  }
	}
	
	
    .area-boxs {
      width: 690rpx;
      min-height: 106rpx;
      background: rgba(249, 250, 251, 1);
      border-radius: 20rpx;
      padding: 28rpx;
      margin: auto;
  
      .img-box {
        margin-top: 20rpx;
      }
    }
    .post-btn {
      width: 690rpx;
      line-height: 80rpx;
      border-radius: 40rpx;
      color: rgba(#fff, 0.9);
      margin-bottom: 20rpx;
    }
  </style>
  